<template>
  <div class="header_right">
    <span class="admin-type">超级管理员</span>
    <span class="el-dropdown-link">
        {{username}}
      </span>
    <span class="el-dropdown-link" @click="logout">
        退出
      </span>
  </div>
</template>

<script>
import store from '@/store/store'
import * as types from '@/store/types'
export default {
  name: 'Header',
  data () {
    return {
      username: store.state.username
    }
  },
  methods: {
    logout () {
      this.$store.commit(types.LOGOUT)
      this.$router.push({
        path: '/login'
      })
    }
  }
}
</script>

<style scoped lang="stylus" rel="stylesheet/stylus">
  .header_right
    text-align center
    line-height 44px
    float right
    font-size 14px
</style>
